<admintpl file="header"/>
<link rel="stylesheet" href="__PUBLIC__/css/jquery.datetimepicker.css">
<link rel="stylesheet" href="__PUBLIC__/css/wechat.css">
<link rel="stylesheet" href="__PUBLIC__/css/main.css">
<script src="__PUBLIC__/js/laydate.js"></script>
<script src="__PUBLIC__/js/uploadify/jquery2.js" type="text/javascript"></script>
<script src="__PUBLIC__/js/artDialog/artDialog.js"></script>
<script src="__PUBLIC__/js/common.js"></script>
<script src="__PUBLIC__/js/wechat.js"></script>

<style>
    .well input, select {
        margin-top: 10px;
    }

    .well select {
        height: 37px;
        line-height: 37px
    }
</style>
</head>

<body>

<div class="manage">
    <span><a href="">微信推送</a></span>
</div>

<div class="act_main">

    <a href="#">微信推送</a>
    >>
    <span class="tag-list">
        素材管理
    </span>

</div>

<div class="wrap">

    <div class="all-tags">
        <span class="tags-count">所有素材({$materialCount}条)</span>
        <span class="export-tags"><a class="btn btn-danger sync-material">同步素材信息</a></span>

    </div>

    <form class="well" style="background-color: #fff" method="post" action="{:U('Matelist/index')}">
        <span>起始时间</span> <input type="text" name="strarExpirationTime" value="{$strarExpirationTime}"
                                 id="startlinetime" placeholder="请选择开始时间">

        <input type="text" name="endExpirationTime" value="{$endExpirationTime}" id="endlinetime" placeholder="请选择结束时间">

        <span>素材类型</span>
        <select name="type">
            <option>请选择素材</option>
            <foreach name="mate" item="v" key="k">
                <option value="{$k}"
                <if condition="$k eq $typeInfo">selected</if>
                >{$v}</option>
            </foreach>
        </select>
        <button type="submit" class="btn btn-primary">查找</button>
        <span id="loading" style="display: inline-block;padding-right: 50px">

        </span>
    </form>

    <table border="1" cellpadding="2" cellspacing="0" width="80%" align="center"
           class="activityList table table-hover table-bordered table-list">
        <tr>
            <td>素材</td>
            <td>创建时间</td>
            <?php if($typeInfo!='news'){ ?>
            <td>名称</td>
            <?php } ?>

            <td>素材类型</td>
            <?php if($typeInfo=='news'){ ?>
            <td>操作</td>
            <td></td>
            <?php } ?>
        </tr>

        <foreach name="list" item="v">
            <tr>
                <td>
                    <ul>
                        <?php if($v['type']=='news'){ ?>
                        <foreach name="v['itemInfo']['news_item']" item="vo">
                            <li>
                                <div id="hotnews">
                                   <?php if($vo['thumb_url']){ ?> <script type="text/javascript">showImg('{$vo.thumb_url}');</script><?php } ?>
                                    <?php echo $vo['title'];?>
                                </div>
                            </li>
                        </foreach>
                        <?php }else{ ?>
                        <div id="hotlinkimg">
                            <script type="text/javascript">showImg('{$v.itemInfo.url}');</script>
                        </div>
                        <?php } ?>
                    </ul>
                </td>
                <td> {$v.meta_add_time|date='Y-m-d H:i:s',###}</td>

                <?php if($typeInfo!='news'){ ?>
                <td>{$v.itemInfo.name}</td>
                <?php } ?>


                <td>{$typeInfo|getMateType}</td>
                <td>
                    <?php if($typeInfo=='news'){ ?>
                    <a href="#" data-toggle="modal" data-target="#JActivityeditact" class="setMobile"
                       data-id="{$v.media_id}" data-title="{$v.title}" data-type="{$typeInfo}">发送手机预览</a>
                </td>
                <td><a href="{:U('Push/Push/add',array('id'=>$v['id'],'media_id'=>$v['media_id']))}">立即推送</a></td>
                <?php } ?>
            </tr>
        </foreach>


    </table>
    <div class="pagination">{$pager}</div>
</div>


<div class="modal fade" id="JActivityeditact" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"
     style="width: 500px; display: none;">
    <div class="modal-dialog" role="document">
        <div class="modal-content">
            <div class="modal-header" style="background-color: #ecf0f1">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span
                        aria-hidden="true">&times;</span></button>
                <h4 class="modal-title" id="myShopLabel" style="color: #000">发送预览 关注公众号后，才能接收图文消息预览</h4>
            </div>

            <input type="hidden" name="media_id">
            <input type="hidden" name="media_title">
            <input type="hidden" name="media_type">

            <div class="modal-body">
                <div class="form-horizontal">

                    <div class="control-group">
                        <div class="control-list">

                            <?php foreach($viewList as $v){ ?>
                                <span>
                                    <input type="checkbox" class="checkbox-openid" data-remark="{$v.remark}"
                                           value="{$v.open_id}" checked> {$v.open_id}  ({$v.remark})
                                </span>
                            <?php } ?>
                        </div>

                    </div>


                    <div class="text-center">
                        <a href="javascript:;" class="add-opemid btn ">添加</a>
                    </div>

                    <div class="Openid-Info text-center"></div>

                </div>
            </div>
            <div class="modal-footer" style="text-align: center">

                <button type="button" class="btn btn-danger JsaveActivity">发送</button>
            </div>
        </div>
    </div>
</div>

<script type="text/javascript">

    var previewUrl = "{:U('Matelist/sendPreview')}";

    var saveOpenId = "{:U('Matelist/saveOpenId')}";

    var MaterialUrl = "{:U('Matelist/index')}";

    $(function () {

        $('#startlinetime').click(function () {
            laydate({elem: '#startlinetime', format: 'YYYY-MM-DD hh:mm:ss', istime: true});
        });

        $('#endlinetime').click(function () {
            laydate({elem: '#endlinetime', format: 'YYYY-MM-DD hh:mm:ss', istime: true});
        });


    })

</script>

<script src="__PUBLIC__/js/tablesorter/dist/js/jquery.tablesorter.min.js"></script>
<script src="__PUBLIC__/js/tablesorter/dist/js/jquery.tablesorter.widgets.min.js"></script>
<link rel="stylesheet" href="__PUBLIC__/js/tablesorter/dist/css/theme.default.min.css">
</body>
</html>